package com.dongdongshop.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016110200786341";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCIAvMop93XW38c/mCnllF53W0MaOBv96QuUc9M7t5NodscYwKeSkRk8H4fGJ24TDPQWOrpbfP6zjLecMtcPK5B9cEZJIwaliWLV1RLZNdEdElkiXVUde1heNsM5a3e6R5pnC2mfnVqZPHFvcAlaTlOG7Ss1Hwzr8kA7kR4Us/kmPnBDADu7OR18DFdf1JcW7KrHf0SwjD1qgEHl0vj2yixpVfInpYq+2jZy6soD0m/ft1WRzXkdjSOIDAdz2MrMEvUCvgBisrlpAtg55m044UHTySJuS55ZptL8Vi7Jn/VHEmO+GaeaFlFFBP0aYLsinlZ7I0c8V27scAAskfkc8sBAgMBAAECggEAfXojNBWx7tVFbs0rBFEEN6ZUzUcQD5vqRqVI1xPj2MECsKyTJM8lS+4mnK+MChObFZKCnfnHRVHn0hlDM4Pzy3xaucRi0MBGQMe/R5LvmgKiFvNNYC8vYWYqyDo4btaoLQxdfSVbU11vQ1tsIddye6HJzEx3jQOWL5qhZlQX4S7tdnqvTD9U1Rr52IS/jaLhf57AkJi/vO8/o3rKH05nWyVcKnVCsCdySDMBeKjXP9ED3TuIcmdgnnQTNcFlaHB8gKEBiRl4YZzywAEQxPlCOWYox1R7vsMjSwfxi0gGHrkJhXNXZeZY1b7UMRB1a/GDsZ7gmGRQnPpMcnEzqU688QKBgQD4aMPfI38SqODO9UF8BXQvrA5Lu0kWiJY/5WcDhF0HYg10PBdsPoskazWcf2zWG1jSa5D4pUOL1O9LglufsMWY4sy7QbR651+96eipnDAP0oE/TqPNzOmBXYuS6MgUE5/+vOrQmCo8vyZoQdQai2uMQNiWdQJVfBKRy2prs+Im/QKBgQCMKu3oZIyvoB6relCGxAh4OhAaSIIf75/CBQa8He3bj0e21lXqekGN82SOsSB+aySxfJSSHbpRAFakSHGT/SRT8vXD4Z33gPKe0MGMUaZmIC/InDakAy3Ic/zbX18fQSkzWUD43XB5LJGD2KvQDgAzWaM8utKULU0TGRqhcooNVQKBgAgBWE6Ylj/DsXr57GJSyqu+n7dREcnoHO9yNR+n5FeYkVZtmVOjsFg8HD4u3RMJTpN5Y/KfYM3gztVgHhPHXpbOuEpQk8BiNHOqVhUhM2tPHVss7Zp0QBIrMZRKbCg5ea576BVQ0gujHVm+xVcVpyGd9Vzj6G9Y0EBijctqwJ8BAoGAbRzqEJNddUYXOfPAhfhKg5Tnfh5dtZCq87VH9d7yj41tDSaywRIkv+TtraqzGdY8PTI20bv0kyPJTp/aUpKn2fXzXWXfu5EUzY7CbIIPH8cEi40Xd/vFgxrPhtIqUUE/Wmqrik+PQ7TvHgzoStDrVQ39ZcQlMxZEvo43TeDFGPUCgYEAkkjxhLoiU26PXkzKuidbNsRYI+QtpOW6VF7EsJFZpIzElowYUSsBKBctUuAFS5jnfJrNHT+7GP4PHhuLJK2PP9riD8tFqsFTJD9tGQQZ+gbRWj4z1tW7XPujPIEY+pqRVd6i/Nj2mPYgbEeJ73nWBC3msPYUUijm3/h9lszaiL8=";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmKHOg4bhY/4ZWp23Y6ysLsE4LOpTrLxixb/BWr/9gGm49BOCcxfkiqpUP81Dbg79+IpGAP7YT9fWENrh0Om4uXj6URd/FkhV3uVXYrBvEL0dK3g24TDCn4Rb2iKSFoZSv3KYRhTHUTMyDwgS6+/tfvX3YBtEsGETCuKlCISgmRPmZZJSyjm8zBylhsdNveZdJSwysrseMQnj3OjxEGpOOJBI0nR4KHCcZDuE24ldQminqP7Oo9/qemuBjKK+2jualrxhqhJm0H7jNi9Yf/x3lEBFOAGJJPUxkY7Vmrqi5OBKuS5KjFIn26gwGZeJqSxoHHeEfOg606GkgqILzMBnZwIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "https://6k650747m2.goho.co/notifyUrl";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "https://6k650747m2.goho.co/returnUrl";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

